#pragma once

#include <windows.h>

#include <boost/function.hpp>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/signal.hpp>

namespace rdc_transport
{
    typedef boost::function<void(LPVOID, UINT32, UINT32, UINT32)> dataEventDelegate;

    class DataEventHandler
    {
    public:
        DataEventHandler();

    public:
        void RegisterWriter(dataEventDelegate writeComplite, dataEventDelegate writeCancelled);
        void RegisterReader(dataEventDelegate dataReceived);

    public:
        boost::signal<void(LPVOID, UINT32, UINT32, UINT32)>& OnEvent(UINT event);

    private:
        typedef boost::signal<void(LPVOID, UINT32, UINT32, UINT32)> signal_t;
        boost::ptr_map<UINT, signal_t> signals;
    };
}
